#include <stdio.h>

int main() {
    int i, flag;
    char str[80], c;
    FILE *fp;

    fp = fopen("d:\\text", "w");
    flag = 1;
    while (flag == 1) {
        printf("input string:\n");
        gets(str);
        fprintf(fp, "%s ", str); // Write the input string to the file
        printf("continue?");
        c = getchar();
        if (c == 'N' || c == 'n')
            flag = 0;
        getchar();
    }

    fclose(fp);
    fp = fopen("d:\\text", "r");
    while (fscanf(fp, "%s", str) != EOF) { // Read the file contents
        for (i = 0; str[i] != '\0'; i++) {
            if (str[i] >= 'a' && str[i] <= 'z')
                str[i] -= 32; // Convert lowercase letters to uppercase
        }
        printf("%s\n", str);
    }

    fclose(fp);
    return 0;
}